package com.py.pythink.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.py.pythink.bo.RentAddBo;
import com.py.pythink.bo.RentBo;
import com.py.pythink.entity.Rent;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wsh
 * @date 2021/7/8 23:00
 */
public interface RentDao extends BaseMapper<Rent> {
    // 根据Fid查询该房是否被租
    @Select("select * from t_rent  where fid=#{fid}")
    Rent selectByFid(int fid);
    // 查询所租房子的详细信息
    @Select("select  d.nickname,o.preurl,r.month,t.type,t.city,t.address,t.price,t.area,t.orientation,t.houseage,t.decoration,t.floor from t_rent r inner join t_tenement t on r.fid = t.id  \n" +
            "inner join t_imglog i on t.id = i.fid inner join t_userdetail d \n" +
            "on t.uid = d.id inner join t_osslog o on i.oid = o.id where #{ruid} and #{fid}")
    List<RentBo> queryByRuid(int ruid);

}
